﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.TracingCommand;
using RBAC.MaHaiBo.Entity.Traceability;
using RBAC.MaHaiBo.Entity;
using RBAC.MaHaiBo.Service.TraceabilityService;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.TracingHandler
{
    public class TracingShowCommandHandler:IRequestHandler<TracingShowCommand, FenYeDTO<TracingDTO>>
    {
        /// <summary>
        /// 溯源服务层
        /// </summary>
        ITracingService TSer;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="TSer">溯源服务层</param>
        public TracingShowCommandHandler(ITracingService TSer)
        {
            this.TSer = TSer;
        }

        public Task<FenYeDTO<TracingDTO>> Handle(TracingShowCommand request, CancellationToken cancellationToken)
        {
            return TSer.GetTracing(request.pageiden, request.pageSzen, request.CommodityName);
        }
    }
}
